﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Ninject;
using Legazpi.Payroll.Services.Interfaces;
using Emz.Core.Models;

namespace Legazpi.Payroll.Web.Admin.Payroll
{
    public partial class EmployeePayrollSummary : System.Web.UI.Page
    {
        [Inject]
        public IPayrollSummaryService _payrollSummaryService { get; set; }

        protected PayrollSummary Model { get; private set; }
        protected string EmployeeName { get; private set; }
       
        protected void Page_Load(object sender, EventArgs e)
        {            
            int empId = 0;
            int payrollId = 1;
            
            if (!string.IsNullOrEmpty(Request.QueryString["empid"]))
            {
                int.TryParse(Request.QueryString["empid"], out empId);
            }

            Model = _payrollSummaryService.GetEmployeePayrollSummary(empId, payrollId);           
            EmployeeName = Model != null ? string.Format("{0}, {1} {2}", Model.Employee.LastName, Model.Employee.FirstName , Model.Employee.MiddleName) : string.Empty;       

        }
    }
}